// https://leetcode.cn/problems/search-in-a-binary-search-tree/
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class Solution {
public:
    TreeNode* searchBST(TreeNode* root, int val) {
		if(!root) return nullptr;
		if(val == root->val) return root;
		if(val > root->val){
			return searchBST(root->right, val);
		}else{
			return searchBST(root->left, val);
		}
    }
};